package util;
import it.unisa.dia.gas.jpbc.Element;
import java.security.PrivateKey;
/**
 * @Classname TreeNode
 * @Description KeK
 * @Date
 * @Created by kevin
 */
public class TreeNode {
    private String id;
    private TreeNode parent;
    private TreeNode leftChild;
    private TreeNode rightChild;
    private Element xi;

    private Element yi;

    public boolean isLeaf;
    TreeNode() {

    }

    TreeNode(String id,Element xi,Element yi) {
        this.id = id;
        this.xi = xi;
        this.yi = yi;

    }
    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof TreeNode)) {
            return false;
        }
        return this.id == ((TreeNode) obj).id;
    }

    public Element getXi() {
        return xi;
    }

    public void setXi(Element xi) {
        this.xi = xi;
    }

    public Element getYi() {
        return yi;
    }

    public void setYi(Element yi) {
        this.yi = yi;
    }
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public TreeNode getParent() {
        return parent;
    }

    public void setParent(TreeNode parent) {
        this.parent = parent;
    }

    public TreeNode getLeftChild() {
        if (!isLeaf)
            return leftChild;
        else
            return null;
    }

    public void setLeftChild(TreeNode leftChild) {
        if (!isLeaf)
            this.leftChild = leftChild;
    }

    public TreeNode getRightChild() {
        if (!isLeaf)
            return rightChild;
        else
            return null;
    }

    public void setRightChild(TreeNode rightChild) {
        if (!isLeaf)
            this.rightChild = rightChild;
    }
}

